package service;

import java.util.List;

import util.db.Page;
import dao.BookDao;
import dao.PublishDao;
import dao.TypeDao;
import entity.Book;
import entity.Publish;
import entity.Type;

public class BookService {
	
	BookDao bookDao = new BookDao();
	
	public List<Publish> findAllPublish() {
		List<Publish> list = new PublishDao().findAll();
		return list;
	}

	public List<Type> findAllType() {
		List<Type> list = new TypeDao().findAll();
		return list;
	}

	public void save(Book book) {
		bookDao.save(book);
		
	}

	public Page<Book> findAllBook(int nowPageNum) {
		Page<Book> page = bookDao.findAllBook(nowPageNum);
		return page;
	}

	public Book findBookById(String id) {
		Book book = bookDao.findbookById(id);
		return book;
	}

	public Page<Book> findSearch(int nowpagenum,String search) {
		
		return bookDao.findSearch(nowpagenum,search);
	}

	public Page<Book> findAllBookByTypeId(int nowPageNum, String id) {
		Page<Book> page = bookDao.findAllBookByTypeId(id,nowPageNum);
		return page;
	}

	public Page<Book> findAllBookByPublishId(int nowPageNum, String id) {
		Page<Book> page = bookDao.findAllBookByPublishId(id,nowPageNum);
		return page;
	}
	
}
